<%-- 
    Document   : removeUnitProd
    Created on : 9/Abr/2010, 9:43:59
    Author     : luis
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"
    import="pt.our.angemc.parser.*"
    import="pt.our.angemc.datatypes.*"
    import="org.json.*"
    import="pt.our.angemc.modifications.RemoveUnitaryProductions"

%>

<%
    JSONObject obj = new JSONObject();
    String text = request.getParameter("text");
    Parser2 p = new Parser2();

    if(p.checkGrammar(text).equals("0"))
    {
        RemoveUnitaryProductions rup = p.getGrammarRUP(text);
        obj.put("success", true);
        obj.put("rup",rup.toString());
    }
    else
    {
        obj.put("success", false);
    }
    out.print(obj);
%>